{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cdff7b0b",
   "metadata": {},
   "source": [
    "## Test `asc_desc2horz_vert.py`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ca904f30",
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import os\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "from mintpy.utils import utils as ut\n",
    "plt.rcParams.update({'font.size': 12})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "28fdc006",
   "metadata": {},
   "source": [
    "### Simulate ENU displacement"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7c2ecc0f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAyQAAAD/CAYAAAAAGxJ1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZ1UlEQVR4nO3df7BndX3f8efr7vJzYVW8io4ipFRKxAw4bG0aQiBVGzW1WtdOGWNrMk3WiraN1WnpFMwGtYmx1doA2p0SScBGNAOMkY5OnKJGrT82NZDZskNAA6JSuIgrLLvsj/vuH+d77fV22fu9u+fez/ee+3zMnNn7Ped8z/d9v3fe9+7r+zmfc1JVSJIkSVILU60LkCRJkrR2GUgkSZIkNWMgkSRJktSMgUSSJElSMwYSSZIkSc0YSCRJkiQ1YyCRJP1Iks8l+a+t65AkrR0GkoFKcl2SOsTyWE/Hf0MSb2IjLZN5PfyBQ2yrJG84yuPbw9IEerIPBZI8d9T7F698VdLyMpAM258Cz16w/LWmFUlaij3AW5Kc1edBkxzb5/EkSToaBpJh21dVDyxYHgRI8rLRpzDfT7IryeeTvHj+k5P8apI7k+xN8nCSL4w+obkYuH60z9zIy3Ur/c1Ja8CXgT8D3vdkOyR5dpKPJflBkj2jvt40b/vF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Buxas20U3ZDgRkhwDfBT4/arayeTU/C7g2qr69oL1k1LfqcAxwOuAC+mGWF8EXM7k1AjwebpfXD8E7qcb7r2FyapxtZno926Cexrs677Y1/2a+Pdtgvvanu6HPb3GrHQgeQzYuGDdRuDRFa7jkJJM0Q1L7wPeOlrdvOYk5wEvBT5wiM3N6xvZM/r3d6vqe1U1A7wfeCUTUuPo5/sZuvNPNwDTwNPozqWdiBpXqYl97ya1p8G+7ot9vSwm+n2b1L62p/thT69NKx1I7gLWJ3n+vHXn0g23NpUkwLV0nx5srqr9o0076Gqc228DcCYrW/PFwBnAfUkeAN4BbE7yvyakPqrqEbpPMeoQmyeiRroJcKcBV1XVE1X1MPARul/Ek1LjajSRfT3hPQ32dV/s6/5NZE/DxPf1xdjTfbCn16KVnrQCfAz4Q7rUewHdUNs5rSfTAB8GvgKctGD9M0Y1bgaOp0voX1nh2k4EnjVv+Q/AH41qa17fvDqvpLuqyDPpPs34U7rh60mq8ZvAZXRXa3kqcDPdsP/E1Lgal0ns60nu6VEd9nV/NdrX/b+nE9fTo7omtq/t6V5rtKfX2LLyL9gl31uA3cB9wOubvwlwOt2nBXvphgPnll8abX8psJNuqPNzwBmN693K6Modk1Qf3Xmp1wA/AB4A/jNw/ITVeN7o9R8BZoBPAM+cpBpX4zJpfb3aenpUk3195DXa1/2/pxPV06OaVlVf29NHVaM9vcaWjH64kiRJkrTiWtwYUZIkSZIAA4kkSZKkhgwkkiRJkpoxkEiSJElqxkAiSZIkqRkDiSRJkqRmDCSSJEmSmjGQSJIkSWrm/wLHsCFLkHGlyAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 864x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "simV, simH = 1, 0.5\n",
    "azimuth = 30  # [0 for north, -90 for east] defined as azimuth angle in degrees measured from the north with anti-clockwise as positive\n",
    "# ENU setup\n",
    "length, width = 100, 100\n",
    "dE = np.zeros((length, width), dtype=np.float32)\n",
    "dN = np.zeros((length, width), dtype=np.float32)\n",
    "dU = np.zeros((length, width), dtype=np.float32)\n",
    "dE[30:70,20:50] = -simH * np.sin(azimuth * np.pi/180) * -1;  dE[30:70,50:80] = simH * np.sin(azimuth * np.pi/180) * -1\n",
    "dN[30:70,20:50] = -simH * np.cos(azimuth * np.pi/180);       dN[30:70,50:80] = simH * np.cos(azimuth * np.pi/180)\n",
    "dU[30:70,20:50] = -simV;                                     dU[30:70,50:80] = simV\n",
    "\n",
    "# plot - ENU\n",
    "kwargs = dict(vmin=-1.5, vmax=1.5, cmap='RdBu', interpolation='nearest');  cbar_len = 0.4\n",
    "fig, axs = plt.subplots(nrows=1, ncols=3, figsize=[12, 4], sharey=True)\n",
    "for ax, data, title in zip(axs, [dE, dN, dU], ['East', 'North', 'Up']):\n",
    "    im = ax.imshow(data, **kwargs);  ax.set_title(title)\n",
    "fig.subplots_adjust(right=0.93); cax = fig.add_axes([0.97, (1.0-cbar_len)/2, 0.015, cbar_len]);  fig.colorbar(im, cax=cax)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "07ccb3f9",
   "metadata": {},
   "source": [
    "### ENU -> asc/desc LOS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4c9090f6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAEGCAYAAACdE2QGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXOUlEQVR4nO3df5BdZ33f8fdnJfmXbBHcNYYGYxNjx6k9tRnU0klwzMRQME1DijIdFZJSQjBjIEk7oalDDSiGdELSkkmxDVHrYGoo2O7YhIYfbpghTGoKQRMjNyqKwQ42Drh4wQj9sJCl/faPc5Yui+7qyjq7596j92vmjHSec+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u2fw/8t7bGiamzrfVamjs1nkLzTujPaKbRJ63O+4Grae6G+SHgDppLERNV57RujvljrtEx332djvmBbqv/BZuU/GFgL/Ag8PK+fwhtXWfTvMPYTzMFubC9oj3+AmAnzRTrnwLn9F1zW9cW2jshJq1OmuvrNwDfBh4G/iNw0gTWeUlbw6PAHHAb8JRJq3NaN8d853U75o+9Tsf8QDc/+0mSJA2CH5MgSZIGwVAjSZIGwVAjSZIGwVAjSZIGwVAjSZIGwVAjSZIGwVAjSZIGwVAjSZIGwVAjSZIG4f8Bz0yC8TTS0PAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x288 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# ENU to LOS\n",
    "inc_angle = 30\n",
    "az_angle_asc = 102\n",
    "az_angle_desc = -102\n",
    "dAsc  = ut.enu2los(dE, dN, dU, inc_angle=inc_angle, az_angle=az_angle_asc)\n",
    "dDesc = ut.enu2los(dE, dN, dU, inc_angle=inc_angle, az_angle=az_angle_desc)\n",
    "\n",
    "# plot - asc/desc LOS\n",
    "fig, axs = plt.subplots(nrows=1, ncols=2, figsize=[8, 4], sharey=True)\n",
    "for ax, data, title in zip(axs, [dAsc, dDesc], ['Asc', 'Desc']):\n",
    "    im = ax.imshow(data, **kwargs);  ax.set_title(title)\n",
    "fig.subplots_adjust(right=0.93);  cax = fig.add_axes([0.98, (1.0-cbar_len)/2, 0.02, cbar_len]);  fig.colorbar(im, cax=cax)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "874936c4",
   "metadata": {},
   "source": [
    "### asc/desc LOS -> horz/vert"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7c64a052",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAEGCAYAAACdE2QGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliI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MzdTeRV0vLhpk+23gS8BpC/afMci5CVhL0+i/1FHGU4GXzNv+PfAHg4xjk3OQ9WaaJzVeTPOT0J/QTKOPW86vAzfQPA3zQuAemlsRY5VzUjfH/HFndMy3n9Mx39Nt5b9g05LvBfYB3wSu7foPYZDrHJqfMA7QTEHObW8cHH81sItmivVB4NyuMw9ybWHwJMS45aS5v34b8H3gCeA/AWvHMOelgwxPATPA3cCLxy3npG6O+dZzO+aPP6djvqebv/tJkiT1gr8mQZIk9YKlRpIk9YKlRpIk9YKlRpIk9YKlRpIk9YKlRpIk9YKlRpIk9YKlRpIk9YKlRpIk9cL/BwUfQc/gMwAnAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 576x288 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# construct design matrix\n",
    "A = np.zeros((2,2), dtype=np.float32)\n",
    "A[0, 0] = np.cos(inc_angle*np.pi/180);  A[0, 1] = np.sin(inc_angle*np.pi/180) * np.cos(az_angle_asc*np.pi/180  - azimuth*np.pi/180)\n",
    "A[1, 0] = np.cos(inc_angle*np.pi/180);  A[1, 1] = np.sin(inc_angle*np.pi/180) * np.cos(az_angle_desc*np.pi/180 - azimuth*np.pi/180)\n",
    "\n",
    "# asc / desc -> horz / vert\n",
    "dLOS = np.vstack((dAsc.flatten(), dDesc.flatten()))\n",
    "dVH = np.dot(np.linalg.pinv(A), dLOS).astype(np.float32)\n",
    "dV = np.reshape(dVH[0, :], (length, width))\n",
    "dH = np.reshape(dVH[1, :], (length, width))\n",
    "\n",
    "# plot\n",
    "fig, axs = plt.subplots(nrows=1, ncols=2, figsize=[8, 4], sharey=True)\n",
    "for ax, data, title in zip(axs, [dH, dV], ['Horz'.format(azimuth), 'Vert']):\n",
    "    im = ax.imshow(data, **kwargs);  ax.set_title(title)\n",
    "fig.subplots_adjust(right=0.93);  cax = fig.add_axes([0.98, (1.0-cbar_len)/2, 0.02, cbar_len]);  fig.colorbar(im, cax=cax)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f5538cc",
   "metadata": {},
   "source": [
    "### Summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "66134d67",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Simulation: horizontal = 0.50, vertical = 1.00\n",
      "Estimation: horizontal = 0.50, vertical = 1.00\n"
     ]
    }
   ],
   "source": [
    "print('Simulation: horizontal = {:.2f}, vertical = {:.2f}'.format(simH, simV))\n",
    "print('Estimation: horizontal = {:.2f}, vertical = {:.2f}'.format(np.max(np.abs(dH)), np.max(np.abs(dV))))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1698f46d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
